var models = require('../../models')
module.exports = {
  up: function(queryInterface, Sequelize) {
    return queryInterface
      .createTable(
        models.Document.tableName,
        models.Document.attributes,
        models.Document.options
      )
      .then(() => {
        let indexes = models.Document.options.indexes || []
        indexes.forEach(n => {
          queryInterface.addIndex(models.Document.tableName, n.fields, {
            indexType: n.method
          })
        })
      })
  },
  down: function(queryInterface, Sequelize) {
    return queryInterface.dropTable(models.Document.tableName)
  }
}
